//
//  HomeVC.m
//  DocumentWatermarking
//
//  Created by apple on 2018/9/25.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "HomeVC.h"
#import "AboutUSVC.h"
#import "MainViewController.h"
#import "AppDelegate.h"

@interface HomeVC ()
@property (weak, nonatomic) IBOutlet UIImageView * headIcon;
@property (weak, nonatomic) IBOutlet UIButton * normalButton;

@end

@implementation HomeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    _headIcon.layer.cornerRadius = 8;
    _headIcon.layer.masksToBounds = YES;
    
    _normalButton.layer.cornerRadius = 22;
    _normalButton.layer.masksToBounds = YES;
    
    
    [self rightButtonImage:[UIImage imageNamed:@""] RightButtonTitle:@"关于我们" rightButtonTarget:self rightButtonAction:@selector(AboutUS)];
    
    [_normalButton addTarget:self action:@selector(normalAction) forControlEvents:UIControlEventTouchUpInside];
    
}


-(void)AboutUS{
    
    [[NSUserDefaults standardUserDefaults] setValue:@"YES" forKey:@"isFirst"];
    
    AboutUSVC *vc =[[AboutUSVC alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}

-(void)normalAction{
    
    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"isFirst"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    
    UIStoryboard *UpgradeHardware = [UIStoryboard storyboardWithName:@"Main" bundle:nil];//UpgradeHardware storyboard的名称
    UIViewController *firstVC = [UpgradeHardware instantiateViewControllerWithIdentifier:@"MainViewController"];
                                 
    AppDelegate*dele = (AppDelegate*)[UIApplication sharedApplication].delegate;
    UINavigationController * nav = [[UINavigationController alloc]initWithRootViewController:firstVC];

    dele.window.rootViewController = nav;
    [dele.window makeKeyAndVisible];

}

@end
